﻿<UserControl x:Class="CBR.Views.OptionsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="900"
             xmlns:Converters="clr-namespace:CBR.Components.Converters"
             xmlns:Model="clr-namespace:CBR.ViewModels" 
			 Background="{DynamicResource CbrDarkBackgroundBrush}">

	<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Style="{DynamicResource CbrScrollViewer}" >

		<Grid Margin="15">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
			</Grid.RowDefinitions>

			<StackPanel>
				<TextBlock Style="{DynamicResource CbrTitleLabel}" Margin="5"
					Text="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.Title, DefaultValue=Application Settings}" />
				<Line Style="{DynamicResource CbrDashedSeparator}" X1="0" X2="1" />
			</StackPanel>

			<Grid Grid.Row="1">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="2*" />
					<ColumnDefinition Width="20" />
					<ColumnDefinition Width="2*" />
					<ColumnDefinition Width="20" />
					<ColumnDefinition Width="Auto" />
				</Grid.ColumnDefinitions>
        
				<StackPanel Orientation="Vertical" Margin="10">
					<TextBlock Style="{DynamicResource CbrSubTitleLabel}" Margin="5"
						 Text="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.LblImages, DefaultValue=Images}" />
					<Label Style="{DynamicResource CbrLabel}" Margin="5" HorizontalAlignment="Stretch"
						   Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblNbImage, DefaultValue=Image in cache}"/>
					<Grid Margin="15,0,15,0">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="70" SharedSizeGroup="Value" />
							<ColumnDefinition Width="*" SharedSizeGroup="Slider" />
						</Grid.ColumnDefinitions>
							<Label Style="{DynamicResource CbrLabel}" Margin="5" HorizontalAlignment="Stretch" Content="{Binding ElementName=sliderImageCache, Path=Value}"/>
							<Slider Style="{DynamicResource CbrSlider}" Grid.Column="1" Margin="15,0,15,0" Name="sliderImageCache" VerticalAlignment="Center" Value="{Binding ImageCacheCount}"
								SmallChange="1" LargeChange="1" Maximum="10" TickPlacement="Both" TickFrequency="1" IsSnapToTickEnabled="True" AutoToolTipPlacement="None" Orientation="Horizontal" />
					</Grid>
					<Label Style="{DynamicResource CbrLabel}" Margin="5" HorizontalAlignment="Stretch"
						   Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblImageDuration, DefaultValue=Image duration (sec. after expiration)}" />
					<Grid Margin="15,0,15,0">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="70" SharedSizeGroup="Value" />
							<ColumnDefinition Width="*" SharedSizeGroup="Slider" />
						</Grid.ColumnDefinitions>
						<Label Style="{DynamicResource CbrLabel}" Margin="5" HorizontalAlignment="Stretch"
							   Content="{Binding ElementName=sliderDurationCache, Path=Value}"/>
						<Slider Style="{DynamicResource CbrSlider}" Grid.Column="1" Margin="15,0,15,0"  Name="sliderDurationCache" VerticalAlignment="Center"  Value="{Binding ImageCacheDuration}"
							SmallChange="1" LargeChange="1" Minimum="10" Maximum="60" TickPlacement="Both" TickFrequency="1" IsSnapToTickEnabled="True" AutoToolTipPlacement="None" />
					</Grid>

					<Line Style="{DynamicResource CbrDashedSeparator}" X1="0" X2="1" />

					<TextBlock Style="{DynamicResource CbrSubTitleLabel}" Margin="5"
					   Text="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblAutoFitMode, DefaultValue=Default auto fit mode}"></TextBlock>
					<RadioButton Style="{DynamicResource CbrRadioButton}" GroupName="AutoFit" Margin="5" Name="rbNone"
						IsChecked="{Binding Path=AutoFitMode, Converter={x:Static Converters:IntToRadioConverter.Instance}, ConverterParameter=0}"
						Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblFitNo, DefaultValue=None : the images are displayed with the zoom factor}" />
					<RadioButton Style="{DynamicResource CbrRadioButton}" GroupName="AutoFit" Margin="5" Name="rbWidth"
						IsChecked="{Binding Path=AutoFitMode, Converter={x:Static Converters:IntToRadioConverter.Instance}, ConverterParameter=1}"
						Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblFitWidth, DefaultValue=Width : each time an image is displayed it is adjusted to fill in width}" />
					<RadioButton Style="{DynamicResource CbrRadioButton}" GroupName="AutoFit" Margin="5" Name="rbHeight" 
						IsChecked="{Binding Path=AutoFitMode, Converter={x:Static Converters:IntToRadioConverter.Instance}, ConverterParameter=2}"
						Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblFitHeight, DefaultValue=Height : each time an image is displayed it is adjusted to fill in height}" />

					<Line Style="{DynamicResource CbrDashedSeparator}" X1="0" X2="1" />

					<TextBlock Style="{DynamicResource CbrSubTitleLabel}" Margin="5"
						Text="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblMagnifier, DefaultValue=Magnifier}" />
					<Label Style="{DynamicResource CbrLabel}" Margin="5" HorizontalAlignment="Stretch"
						  Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblMagnifierSize, DefaultValue=Size of the magnifier}" />
					<Grid Margin="15,0,15,0">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="70" SharedSizeGroup="Value" />
						<ColumnDefinition Width="*" SharedSizeGroup="Slider" />
					</Grid.ColumnDefinitions>
						<Label Style="{DynamicResource CbrLabel}" Grid.Column="0" Margin="5" HorizontalAlignment="Stretch" Content="{Binding ElementName=sliderMagnifierSize, Path=Value }" ContentStringFormat="F1" Grid.ColumnSpan="2" />
						<Slider Style="{DynamicResource CbrSlider}" Grid.Column="1" Margin="15,0" Name="sliderMagnifierSize" VerticalAlignment="Center" Value="{Binding MagnifierSize}"
							SmallChange="0.1" LargeChange="0.1" Minimum="0.5" Maximum="2" TickPlacement="Both" AutoToolTipPlacement="None"
							Grid.ColumnSpan="2" IsSnapToTickEnabled="True" TickFrequency="0.1" />
				</Grid>
					<Label Style="{DynamicResource CbrLabel}" Margin="5" HorizontalAlignment="Stretch"
					  Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblMagnifierScale, DefaultValue=Scaling factor}" />
					<Grid Margin="15,0,15,0">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="70" SharedSizeGroup="Value" />
						<ColumnDefinition Width="*" SharedSizeGroup="Slider" />
					</Grid.ColumnDefinitions>
						<Label Style="{DynamicResource CbrLabel}" Grid.Column="0" Margin="5" HorizontalAlignment="Stretch" Content="{Binding ElementName=sliderMagnifierScale, Path=Value, StringFormat=D}" Grid.ColumnSpan="2" />
						<Slider Style="{DynamicResource CbrSlider}" Grid.Column="1" Margin="15,0"  Name="sliderMagnifierScale" VerticalAlignment="Center" Value="{Binding MagnifierScaleFactor}"
							SmallChange="10" LargeChange="30" Minimum="100" Maximum="300" TickPlacement="Both" AutoToolTipPlacement="None"
							Grid.ColumnSpan="2" IsSnapToTickEnabled="True" TickFrequency="10" />
				</Grid>

			</StackPanel>

			<Line Grid.Column="1" X1="0" Y2="1" Style="{DynamicResource CbrVerticalSeparator}" />

			<StackPanel Grid.Column="2" Orientation="Vertical" Margin="10">
            
				<TextBlock Style="{DynamicResource CbrSubTitleLabel}" Margin="5"
					   Text="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblOthers, DefaultValue=Others}" ></TextBlock>
					<Label Style="{DynamicResource CbrLabel}" Margin="15,5,15,5" HorizontalAlignment="Stretch"
					   Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblMaxRecent, DefaultValue=Maximum mumber of recent book or library in the recent file list}"></Label>
					<Grid Margin="15,0,15,0">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="70" SharedSizeGroup="Value" />
							<ColumnDefinition Width="*" SharedSizeGroup="Slider" />
						</Grid.ColumnDefinitions>
						<Label Style="{DynamicResource CbrLabel}" Margin="5" HorizontalAlignment="Stretch" Content="{Binding ElementName=sliderRecentFileMax, Path=Value}"/>
						<Slider Style="{DynamicResource CbrSlider}" Grid.Column="1" Margin="15,0,15,0" Name="sliderRecentFileMax" VerticalAlignment="Center" Value="{Binding MaxRecentFile}"
						SmallChange="2" LargeChange="1" Maximum="20" TickPlacement="Both" TickFrequency="2" IsSnapToTickEnabled="True" AutoToolTipPlacement="None"
						Minimum="5" />
					</Grid>
					<Label Style="{DynamicResource CbrLabel}" Margin="15,5,15,5" HorizontalAlignment="Stretch"
					   Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.lblStartLanguage, DefaultValue=Starting language if not system default}"></Label>

					<ComboBox Style="{DynamicResource CbrStandardComboBox}" Margin="20,5,20,5" ItemsSource="{Binding Languages}" SelectedItem="{Binding StartingLanguage, Mode=TwoWay}"
						  ItemTemplate="{DynamicResource LanguageTemplate}" />

				<Line Style="{DynamicResource CbrDashedSeparator}" X1="0" X2="1" />

				<TextBlock Style="{DynamicResource CbrSubTitleLabel}" Margin="5">Extended options</TextBlock>
					<Button Style="{DynamicResource CbrStandardButton}" Margin="30,10,30,10" Height="60"
							Content="Extended options..." Name="btnExtendedOptions" Click="btnExtendedOptions_Click" />

				<Line Style="{DynamicResource CbrDashedSeparator}" X1="0" X2="1" />

			</StackPanel>

			<Line Grid.Column="3" X1="0" Y2="1" Style="{DynamicResource CbrVerticalSeparator}" />

			<StackPanel Grid.Column="5" Orientation="Vertical" Margin="10" >
					<Button Style="{DynamicResource CbrStandardButton}" Width="80" Height="80" Margin="10"
						Command="{Binding SaveSettingsCommand}"
						Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.BtnSave, DefaultValue=Save}" />
					<Button Style="{DynamicResource CbrStandardButton}" Width="80" Height="80" Margin="10"
						Command="{Binding ResetSettingsCommand}"
						Content="{LocalizationExtension ResModul=CBR.Backstage, Key=OptionView.BtnReset, DefaultValue=Reset}" />
			</StackPanel>
			</Grid>
		</Grid>
	</ScrollViewer>	
</UserControl>
